package com.trade.form;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;

/**
 * 
 * @author Lin Yang
 * 
 */
public class UserForm extends ActionForm {
    private static final long serialVersionUID = -8434860126812542019L;

    private String loginName;
    private String password;
    private long roleid;
    private String name;
    private String email;
    private String mobileNumber;
  
    @Override
    public void reset(ActionMapping mapping, HttpServletRequest request) {
    	loginName = "";
        password = "";
    }
    

    @Override
    public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
        ActionErrors errors = new ActionErrors();
        if ("".equals(loginName.trim())) {
            errors.add("un", new ActionMessage("请输入用户名", false));
        } else if ("".equals(password.trim())) {
            errors.add("pwd", new ActionMessage("请输入密码", false));
        }
        return errors;
    }

	public String getLoginName() {
		return loginName;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public long getRoleid() {
		return roleid;
	}

	public void setRoleid(long roleid) {
		this.roleid = roleid;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getMobileNumber() {
		return mobileNumber;
	}

	public void setMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
	}
    
}
